<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../vue.js"></script>
    <style>
        .login {
            background-color: yellowgreen;
        }

        .register {
            background-color: pink;
        }
    </style>
</head>

<body>
    <div id="app">
        <div>
            <button @click="isLogin=true">登录</button>
            <button @click="isLogin=false">注册</button>
        </div>
        <div>
            <h1>请{{isLogin?"登录":"注册"}}</h1>
            <form action="###" v-if="isLogin" class="login" key="login">
                <input type="text" name="username">
                <input type="password" name="password">
            </form>
            <form action="###" v-else class="register" key="register">
                <input type="text" name="username">
                <input type="password" name="password">
            </form>
        </div>

    </div>
    <script>
        Vue.config.prodactionTip = false

        const vm = new Vue({
            el: "#app",
            data() {
                return {
                    isLogin: true
                }
            }
        })
    </script>
</body>

</html>